import java.sql.*;
import javax.sql.*;

public class conexaoBD {

	String dbtime;
	String user = "root";
	String pass = "qwqwqw";
	String dbUrl = "jdbc:mysql://localhost/rcFirewall";
	String dbClass = "com.mysql.jdbc.Driver";
	//String query = "Select * FROM DESTINATION";

	public void montaDropDown(String query, int coluna){
	
	try {

	Class.forName("com.mysql.jdbc.Driver");
	Connection con = DriverManager.getConnection (dbUrl,user,pass);
	Statement stmt = con.createStatement();
	ResultSet rs = stmt.executeQuery(query);

	while (rs.next()) {
	dbtime = rs.getString(coluna);	
	System.out.println(dbtime);
	} //end while

	con.close();
	} //end try

	catch(ClassNotFoundException e) {
	e.printStackTrace();
	}

	catch(SQLException e) {
	e.printStackTrace();
	}

	}  //end main
}
